/**
 * 默认的cookie写入方法
 * @param name
 * @param value
 */
function setCookie(name,value){
    var Days = 1;
    var exp = new Date();
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "="+ encodeURI (value) + ";expires=" + exp.toGMTString()+";path=/leasingCalculator";
}

/**
 * cookie写入方法,并设置过期时间
 * @param name Cookie中的名称
 * @param value Cookie的value
 * @param expireTime 过期时间
 */
function setCookie(name,value, expireTime){
    var Days = 1;
    var exp = new Date();
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "="+ encodeURI (value) + ";expires=" + exp.toGMTString()+";path=/leasingCalculator";
}

/**
 * 获取Cookie中的值
 * @param objName
 * @returns
 */
function getCookie(objName){//获取指定名称的cookie的值
    var arrStr = document.cookie.split("; ");
    for (var i = 0; i < arrStr.length; i++) {
        var temp = arrStr[i].split("=");
        if (temp[0] == objName){
            return decodeURI(temp[1]);
        }
    }
}

/**
 * 校验真实姓名
 * @param name
 * @returns {boolean}
 */
function regName(name) {
    var regName =/^[\u4e00-\u9fa5]{2,4}$/;
    if(!regName.test(name)){
        return false;
    }
    return true;
}

/**
 * 校验身份证号
 * @param idNumber
 * @returns {boolean}
 */
function regIdNumber(idNumber) {
    var regIdNo = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
    if(!regIdNo.test(idNumber)){
        return false;
    }
    return true;
}